Repository navigation
fix(gpkg): merge GPKG sources lowest zoom first again - #277
Merged
Merged
Conversation
Keyset paging moved GetBatch from `ORDER BY zoom_level LIMIT/OFFSET` to
`WHERE rowid > $lastId ORDER BY rowid`. Rowid order is insertion order, so
tables not stored lowest zoom first are now merged in a different order.
That changes output: a partial tile is filled by upscaling the closest
lower zoom already in the target. On a z16+z18 merge whose source stores
z18 rows first, 897 of 34,764 tiles differed from v2.2.3.
Page on the GPKG's UNIQUE(zoom_level, tile_column, tile_row) index instead:
`WHERE (zoom_level, tile_column, tile_row) > (z, x, y)`. That is the order
v2.2.3's query used (it scanned the same index), and the seek keeps the
constant page cost. GPKG and FS outputs of that merge are now
byte-identical to v2.2.3.
The cursor is the last tile's coordinates; the resume batch identifier
becomes "z/x/y" ("0" before the first batch), and anything else is
rejected instead of silently restarting.
Closes #276
…cursor The journal-mode tests merged from master still passed an int offset to GetBatch, which now takes a tile cursor, so the test project no longer compiled.
CL-SHLOMIKONCHA
approved these changes
Nov 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related issues: #255
Closes #276
Further information:
Since #255, GPKG sources are paged by rowid, so a table that isn't stored lowest zoom first is merged in a different order than in v2.2.3, and partial tiles get filled from a different lower zoom.
GetBatchpages on the GPKG'sUNIQUE(zoom_level, tile_column, tile_row)index withWHERE (zoom_level, tile_column, tile_row) > (z, x, y). That is the order v2.2.3 read in, and the seek keeps perf(gpkg): connection reuse + prepared bulk-insert + keyset paging (MAPCO-11320) #255's constant page cost.z/x/y("0"before the first batch); anything else is rejected. perf(gpkg): connection reuse + prepared bulk-insert + keyset paging (MAPCO-11320) #255 already changed this format and it hasn't been released.Tests: all unit tests pass (1,128 MergerLogic, 23 MergerService). A z16+z18 merge into a GPKG and into an FS tree is byte-identical to v2.2.3 on all 34,764 tiles; on master 897 tiles differ.
Touches
GpkgClient.cslike #274, in a different method; the two merge without conflict.